/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ReservaEntradas.java
 *
 * Created on 20/06/2011, 09:26:17 PM
 */

package guiKiosco;

import java.util.LinkedList;
import java.util.List;
import javax.swing.JOptionPane;
import logica.Fabrica;
import logica.IKiosco;
import util.datatypes.DTFuncion;
import util.datatypes.DTPelicula;
import util.datatypes.DTTiposEntrada;

/**
 *
 * @author bruno
 */
public class ReservaEntradas extends javax.swing.JFrame {

    private int cantMenor = 0;
    private int cantComun = 0;
    private int cantMayor = 0;
    private int cantTotal = 0;
    private int entradasDisp = 0;
    private double totalpago = 0;
    DTPelicula pelicula;
    DTFuncion funcion;
    DTTiposEntrada menor;
    DTTiposEntrada mayor;
    DTTiposEntrada comun;

    public ReservaEntradas(){
        initComponents();
    }

    public ReservaEntradas(DTPelicula peli, DTFuncion func) {
        initComponents();

        this.setLocationRelativeTo(null);
        this.setSize(1024, 768);

        IKiosco i = Fabrica.getIKiosco();

        menor =  i.getTipoMenor();
        comun = i.getTipoComun();
        mayor = i.getTipoMayor();

        pelicula = peli;
        funcion = func;

        entradasDisp = i.contarEntradas(func);

        txtComun.setText("0");
        txtMayor.setText("0");
        txtMenor.setText("0");

        lblPelicula.setText(peli.getNombre());
        lblFuncion.setText(i.obtenerHoraString(func.getHoraInicio()));
        lblCantEntradas.setText("   " +  entradasDisp);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pSuperior = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        lblFuncion = new javax.swing.JLabel();
        lblPelicula = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        btnMenorDown = new javax.swing.JButton();
        txtMenor = new javax.swing.JTextField();
        btnMenorUp = new javax.swing.JButton();
        btnComunDown = new javax.swing.JButton();
        txtComun = new javax.swing.JTextField();
        btnComunUp = new javax.swing.JButton();
        btnMayorDown = new javax.swing.JButton();
        txtMayor = new javax.swing.JTextField();
        btnMayorUp = new javax.swing.JButton();
        lblTotalComun = new javax.swing.JLabel();
        lbltotalMenor = new javax.swing.JLabel();
        lblTotal = new javax.swing.JLabel();
        lblTotalMayor = new javax.swing.JLabel();
        btnAtras = new javax.swing.JButton();
        lblTotal1 = new javax.swing.JLabel();
        btnAceptar1 = new javax.swing.JButton();
        lblFuncion1 = new javax.swing.JLabel();
        lblCantEntradas = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(1024, 768));

        pSuperior.setPreferredSize(new java.awt.Dimension(1024, 768));

        jLabel1.setFont(new java.awt.Font("Arial", 1, 36)); // NOI18N
        jLabel1.setText("Seleccione sus entradas");

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/Invoice.png"))); // NOI18N

        lblFuncion.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N
        lblFuncion.setText("[funcion]");

        lblPelicula.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N
        lblPelicula.setText("[pelicula]");

        jPanel1.setForeground(new java.awt.Color(3, 81, 2));
        jPanel1.setPreferredSize(new java.awt.Dimension(1024, 768));

        jLabel3.setFont(new java.awt.Font("Arial", 1, 36));
        jLabel3.setText("Menor");

        jLabel4.setFont(new java.awt.Font("Arial", 1, 36));
        jLabel4.setText("Comun");

        jLabel5.setFont(new java.awt.Font("Arial", 1, 36));
        jLabel5.setText("Mayor");

        btnMenorDown.setBackground(new java.awt.Color(242, 241, 240));
        btnMenorDown.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/minus.png"))); // NOI18N
        btnMenorDown.setBorder(null);
        btnMenorDown.setBorderPainted(false);
        btnMenorDown.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenorDownActionPerformed(evt);
            }
        });

        txtMenor.setColumns(2);
        txtMenor.setFont(new java.awt.Font("Arial", 1, 36));
        txtMenor.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        btnMenorUp.setBackground(new java.awt.Color(242, 241, 240));
        btnMenorUp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/plus.png"))); // NOI18N
        btnMenorUp.setBorder(null);
        btnMenorUp.setBorderPainted(false);
        btnMenorUp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenorUpActionPerformed(evt);
            }
        });

        btnComunDown.setBackground(new java.awt.Color(242, 241, 240));
        btnComunDown.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/minus.png"))); // NOI18N
        btnComunDown.setBorder(null);
        btnComunDown.setBorderPainted(false);
        btnComunDown.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnComunDownActionPerformed(evt);
            }
        });

        txtComun.setColumns(2);
        txtComun.setFont(new java.awt.Font("Arial", 1, 36));
        txtComun.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        btnComunUp.setBackground(new java.awt.Color(242, 241, 240));
        btnComunUp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/plus.png"))); // NOI18N
        btnComunUp.setBorder(null);
        btnComunUp.setBorderPainted(false);
        btnComunUp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnComunUpActionPerformed(evt);
            }
        });

        btnMayorDown.setBackground(new java.awt.Color(242, 241, 240));
        btnMayorDown.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/minus.png"))); // NOI18N
        btnMayorDown.setBorder(null);
        btnMayorDown.setBorderPainted(false);
        btnMayorDown.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMayorDownActionPerformed(evt);
            }
        });

        txtMayor.setColumns(2);
        txtMayor.setFont(new java.awt.Font("Arial", 1, 36));
        txtMayor.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        btnMayorUp.setBackground(new java.awt.Color(242, 241, 240));
        btnMayorUp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/plus.png"))); // NOI18N
        btnMayorUp.setBorder(null);
        btnMayorUp.setBorderPainted(false);
        btnMayorUp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMayorUpActionPerformed(evt);
            }
        });

        lblTotalComun.setFont(new java.awt.Font("Arial", 0, 36));
        lblTotalComun.setForeground(new java.awt.Color(3, 81, 2));
        lblTotalComun.setText("$ 0.0");

        lbltotalMenor.setFont(new java.awt.Font("Arial", 0, 36));
        lbltotalMenor.setForeground(new java.awt.Color(3, 81, 2));
        lbltotalMenor.setText("$ 0.0");

        lblTotal.setFont(new java.awt.Font("Arial", 1, 36));
        lblTotal.setForeground(new java.awt.Color(3, 81, 2));
        lblTotal.setText("$ 0.0");

        lblTotalMayor.setFont(new java.awt.Font("Arial", 0, 36));
        lblTotalMayor.setForeground(new java.awt.Color(3, 81, 2));
        lblTotalMayor.setText("$ 0.0");

        btnAtras.setBackground(new java.awt.Color(242, 241, 240));
        btnAtras.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/arrow_left.png"))); // NOI18N
        btnAtras.setBorder(null);
        btnAtras.setBorderPainted(false);
        btnAtras.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAtrasActionPerformed(evt);
            }
        });

        lblTotal1.setFont(new java.awt.Font("Arial", 1, 36));
        lblTotal1.setText("Total a pagar");

        btnAceptar1.setBackground(new java.awt.Color(242, 241, 240));
        btnAceptar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guiKiosco/resources/arrow_right.png"))); // NOI18N
        btnAceptar1.setBorder(null);
        btnAceptar1.setBorderPainted(false);
        btnAceptar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAceptar1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(52, 52, 52)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel5)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 149, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(btnMayorDown, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtMayor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnMayorUp, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(btnMenorDown, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtMenor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnMenorUp, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(btnComunDown, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtComun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnComunUp, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 294, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblTotal1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 118, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbltotalMenor)
                    .addComponent(lblTotalMayor)
                    .addComponent(lblTotalComun)
                    .addComponent(lblTotal))
                .addGap(197, 197, 197))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(626, Short.MAX_VALUE)
                .addComponent(btnAtras)
                .addGap(215, 215, 215))
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addContainerGap(798, Short.MAX_VALUE)
                    .addComponent(btnAceptar1)
                    .addGap(43, 43, 43)))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtMenor, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnMenorUp, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE))
                        .addComponent(btnMenorDown, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addComponent(jLabel3))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(lbltotalMenor)))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(52, 52, 52)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtComun, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(btnComunUp, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE))
                            .addComponent(btnComunDown, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(60, 60, 60)
                        .addComponent(lblTotalComun))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(67, 67, 67)
                        .addComponent(jLabel4)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(46, 46, 46)
                                .addComponent(lblTotalMayor)
                                .addGap(56, 56, 56)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblTotal)
                                    .addComponent(lblTotal1)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(34, 34, 34)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(txtMayor, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(btnMayorUp, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE))
                                    .addComponent(btnMayorDown, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(71, 71, 71)
                        .addComponent(jLabel5)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnAtras)
                .addContainerGap(19, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addContainerGap(413, Short.MAX_VALUE)
                    .addComponent(btnAceptar1)
                    .addGap(22, 22, 22)))
        );

        lblFuncion1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        lblFuncion1.setText("Entradas Disponibles");

        lblCantEntradas.setFont(new java.awt.Font("Arial", 1, 48)); // NOI18N
        lblCantEntradas.setForeground(new java.awt.Color(15, 147, 44));
        lblCantEntradas.setText("Num");

        javax.swing.GroupLayout pSuperiorLayout = new javax.swing.GroupLayout(pSuperior);
        pSuperior.setLayout(pSuperiorLayout);
        pSuperiorLayout.setHorizontalGroup(
            pSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pSuperiorLayout.createSequentialGroup()
                .addGap(64, 64, 64)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(81, 81, 81)
                .addGroup(pSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addGroup(pSuperiorLayout.createSequentialGroup()
                        .addComponent(lblPelicula)
                        .addGap(63, 63, 63)
                        .addComponent(lblFuncion)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 149, Short.MAX_VALUE)
                .addGroup(pSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblFuncion1)
                    .addComponent(lblCantEntradas))
                .addContainerGap())
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 969, Short.MAX_VALUE)
        );
        pSuperiorLayout.setVerticalGroup(
            pSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pSuperiorLayout.createSequentialGroup()
                .addGroup(pSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pSuperiorLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel2))
                    .addGroup(pSuperiorLayout.createSequentialGroup()
                        .addGap(45, 45, 45)
                        .addGroup(pSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pSuperiorLayout.createSequentialGroup()
                                .addComponent(lblFuncion1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lblCantEntradas, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pSuperiorLayout.createSequentialGroup()
                                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(pSuperiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblPelicula)
                                    .addComponent(lblFuncion))))))
                .addGap(18, 18, 18)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 563, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        getContentPane().add(pSuperior, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnMenorDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenorDownActionPerformed

        if (cantTotal >=0 && cantMenor > 0) {

            cantMenor--;
            cantTotal--;

            txtMenor.setText(String.valueOf(cantMenor));

            lbltotalMenor.setText("$ " + String.valueOf(menor.getPrecioTipo() * cantMenor));

            calcularTotal();
        }
    }//GEN-LAST:event_btnMenorDownActionPerformed

    private void btnMenorUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenorUpActionPerformed

        if (cantTotal < 5 && cantMenor < 5) {

            cantMenor++;
            cantTotal++;

            txtMenor.setText(String.valueOf(cantMenor));

            lbltotalMenor.setText("$ " + String.valueOf(menor.getPrecioTipo() * cantMenor));

            calcularTotal();
        }
    }//GEN-LAST:event_btnMenorUpActionPerformed

    private void btnComunDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnComunDownActionPerformed

        if (cantTotal >= 0 && cantComun > 0) {

            cantComun--;
            cantTotal--;

            txtComun.setText(String.valueOf(cantComun));

            lblTotalComun.setText("$ " + String.valueOf(comun.getPrecioTipo() * cantComun));

            calcularTotal();
        }
    }//GEN-LAST:event_btnComunDownActionPerformed

    private void btnComunUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnComunUpActionPerformed

        if (cantTotal < 5 && cantComun < 5) {

            cantComun++;
            cantTotal++;

            txtComun.setText(String.valueOf(cantComun));

            lblTotalComun.setText("$ " + String.valueOf(comun.getPrecioTipo() * cantComun));

            calcularTotal();
        }
    }//GEN-LAST:event_btnComunUpActionPerformed

    private void btnMayorDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMayorDownActionPerformed

        if (cantTotal >= 0 && cantMayor > 0) {

            cantMayor--;
            cantTotal--;

            txtMayor.setText(String.valueOf(cantMayor));

            lblTotalMayor.setText("$ " + String.valueOf(mayor.getPrecioTipo() * cantMayor));

            calcularTotal();
        }
    }//GEN-LAST:event_btnMayorDownActionPerformed

    private void btnMayorUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMayorUpActionPerformed

        if (cantTotal < 5 && cantMayor < 5) {

            cantMayor++;
            cantTotal++;

            txtMayor.setText(String.valueOf(cantMayor));

            lblTotalMayor.setText("$ " + String.valueOf(mayor.getPrecioTipo() * cantMayor));

            calcularTotal();
        }
    }//GEN-LAST:event_btnMayorUpActionPerformed

    private void btnAtrasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAtrasActionPerformed

        ListaFunciones frm = new ListaFunciones(pelicula);
        frm.setVisible(true);

        this.setVisible(false);

    }//GEN-LAST:event_btnAtrasActionPerformed

    private void btnAceptar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAceptar1ActionPerformed

        try{

            if (cantTotal > 0) {

                if ((entradasDisp - cantTotal) >= 0 ) {

                    List<DTTiposEntrada> entradas = new LinkedList<DTTiposEntrada>();

                    menor.setCantidadEntradas(Integer.parseInt(txtMenor.getText()));
                    entradas.add(menor);

                    mayor.setCantidadEntradas(Integer.parseInt(txtMayor.getText()));
                    entradas.add(mayor);

                    comun.setCantidadEntradas(Integer.parseInt(txtComun.getText()));
                    entradas.add(comun);

                    IngresoUsuario frm = new IngresoUsuario(totalpago, funcion, entradas);
                    frm.setVisible(true);

                    this.setVisible(false);

                }else{

                    JOptionPane.showMessageDialog(null, "No hay entradas disponibles");
                }

            }else{

                JOptionPane.showMessageDialog(null, "Tiene que elegir por lo menos una entrada");
            }


        }catch(Exception ex){
            JOptionPane.showMessageDialog(null, "Error:" + ex.getMessage());
        }
    }//GEN-LAST:event_btnAceptar1ActionPerformed

    private void calcularTotal(){
    
        totalpago = 0;
        totalpago = menor.getPrecioTipo() * cantMenor;
        totalpago = totalpago + comun.getPrecioTipo() * cantComun;
        totalpago = totalpago + mayor.getPrecioTipo() * cantMayor;
        
        lblTotal.setText("$ " + String.valueOf(totalpago));
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ReservaEntradas().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAceptar1;
    private javax.swing.JButton btnAtras;
    private javax.swing.JButton btnComunDown;
    private javax.swing.JButton btnComunUp;
    private javax.swing.JButton btnMayorDown;
    private javax.swing.JButton btnMayorUp;
    private javax.swing.JButton btnMenorDown;
    private javax.swing.JButton btnMenorUp;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lblCantEntradas;
    private javax.swing.JLabel lblFuncion;
    private javax.swing.JLabel lblFuncion1;
    private javax.swing.JLabel lblPelicula;
    private javax.swing.JLabel lblTotal;
    private javax.swing.JLabel lblTotal1;
    private javax.swing.JLabel lblTotalComun;
    private javax.swing.JLabel lblTotalMayor;
    private javax.swing.JLabel lbltotalMenor;
    private javax.swing.JPanel pSuperior;
    private javax.swing.JTextField txtComun;
    private javax.swing.JTextField txtMayor;
    private javax.swing.JTextField txtMenor;
    // End of variables declaration//GEN-END:variables

}
